package com.luu.game.dao.impl;

import com.luu.game.dao.RegionDao;
import com.luu.game.data.dto.RegionDTO;
import com.luu.game.data.entity.RegionEntity;
import com.luu.game.mapper.RegionMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RegionDaoImpl implements RegionDao {

    @Autowired
    private RegionMapper regionMapper;

    @Override
    public RegionDTO findByRegionId(Integer regionId) {
        final RegionDTO result = new RegionDTO();
        final RegionEntity regionEntity = regionMapper.selectById(regionId);
        BeanUtils.copyProperties(regionEntity,result);
        return result;
    }
}
